package sctu.edu.java.year2016.team05.xionglianjin.day20160522.chapter4_3;

/**
 * Created by lianjin on 2016/5/22.
 * 编写java程序，使用while循环语句计算1+1/2！+1/3！+........1/20！。
 */
public class Leijai {
    public static void main(String[] args) {
        double i = 1,  m = 1, s = 0;
        while (i <= 20) {
            m=m*i;
            i=i+1;
            s=s+1/m;
        }
        System.out.println(s);
    }
}